Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with upstream's AT_EMPTY_PATH patch series #56

Merged

Conversation

dscho
Copy link
Member

@dscho dscho commented Jul 26, 2023

This reflects https://inbox.sourceware.org/cygwin-patches/20230712120804.2992142-1-corinna-cygwin@cygwin.com/t/#u, which is a patch series that addresses more completely the AT_EMPTY_PATH problem we fixed in #54.

dscho and others added 5 commits July 26, 2023 10:35
In preparation for applying the patch series proposed in
https://inbox.sourceware.org/cygwin-patches/20230712120804.2992142-1-corinna-cygwin@cygwin.com/
let's drop this patch of ours.

Both changes are intended to fix the problem where `tar xf` would
stumble over symlinks, seemingly having trouble changing the mode bits,
but our patch addressed really only that bug while the upstream patch
series addresses the broader AT_EMPTY_PATH handling.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The check if the local variable p is NULL is useless.  The preceeding
code always sets p to a valid pointer, or it crashes if path_ret is
invalid (which would be a bug in Cygwin).

Fixes:c57b57e5c43a ("* cygwin.din: Sort.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Cygwin needs an internal flag to allow specifying an empty pathname
in utimesat (GLIBC extension). We define it in _default_fcntl.h to
make sure we never introduce a value collision accidentally.
While at it, define the values as 16 bit hex values.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Convert gen_full_path_at to take flag values from the caller, rather
than just a bool indicating that empty paths are allowed.  This is in
preparation of a better AT_EMPTY_PATH handling in a followup patch.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
The GLIBC extension AT_EMPTY_PATH allows the functions fchownat
and fstatat to operate on dirfd alone, if the given pathname is an
empty string.  This also allows to operate on any file type, not
only directories.

Commit fa84aa4 broke this.  It only allows dirfd to be a
directory in calls to these two functions.

Fix that by handling AT_EMPTY_PATH right in gen_full_path_at.
A valid dirfd and an empty pathname is now a valid combination
and, noticably, this returns a valid path in path_ret.  That
in turn allows to remove the additional path generation code
from the callers.

Fixes: fa84aa4 ("Cygwin: fix errno values set by readlinkat")
Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho
Copy link
Member Author

dscho commented Aug 29, 2023

I'm going to go to merge this, even if I don't think we need to deploy it just yet in time for Git for Windows v2.42.0(2).

@dscho dscho merged commit 8ed211a into git-for-windows:main Aug 29, 2023
2 checks passed
@dscho dscho deleted the sync-with-upstream-at-empty-path-patch-series branch August 29, 2023 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants